<?php
	$path_one = 'admin/main';
	$path_two = 'admin/admin_child_list';
	$filename = 'admin/admin_child_list';
	require_once("header.php");
	require_once("admin_comm.php");
	require_once $_site->get_handlepath('admin');

	$admin_obj = new admin();
	$user_info = $admin_obj->out_cookie();
	//总管理
	if(6==$user_info['group']){
		$master=request('master',false,true,false,0);
		$master_list=admin_fun_list(array('master'=>true),1,10);
	}else{
		$master=$user_info['id'];		
	}	
		
	$result=admin_fun_list(array('limit'=>true,'child'=>$master),1,10);	
?>
<script type="text/javascript" charset="utf-8">

	loader.file({
		plugin:['validform/main','dialog/main'],
		js:['city_area', 'html'],
		skincss:['list']
	});
	$(document).ready(function(){

	});

</script>
</head>
<body>
	<div class="position_nav">你所在的当前位置：<?php echo $path_str;?></div>
		<div class="main">
			<div class="list_bottom">
				<form action="/admin/admin_child_list" id="search" method='get'>
				    <?php 
				    if(6==$user_info['group']){		    
				    ?>
					<span>项目经理：</span>
				    <select name='master'>
					   <option value="">请选择</option>
					      <?php 
					      if($master_list){
					      foreach($master_list as $key=>$val){
                          ?>
                             <option value="<?php echo $val['id']?>" <?php if($val['id']==$master){echo "selected";} ?>><?php echo $val['name']?></option>
                          <?php 
                             }
                          }
					      ?>					 
					</select>						
					<input class="button1" type="submit" value="搜索">
					<?php 
					}
					?>
					<input type="button" onclick="window.location.href='/admin/admin_child_edit';return false;" value="添加管理员" class="button1">
				</form>							
			</div>
			<table cellpadding="0" cellspacing="1" border="0" class="table">
				<tr>
					<th width="58" align="center">用户id号</th>
					<th width="73" align="left">用户帐号</th>
					<th width="68" align="left">用户名称</th>
					<th width="34" align="center">电话</th>
					<th width="34" align="left">邮箱</th>
					<th width="34" align="center">性别</th>
					<th width="34" align="center">状态</th>										
					<th width="61" align="center">操作</th>
				</tr>
				<?php
					if($result['rows']){
						foreach ($result['rows'] as $v){
							?>
							<tr>
								<td align="center"><?php echo $v['id'] ;?></td>
								<td align="left"><?php echo $v['account'] ;?></td>
								<td align="left"><?php echo $v['name'] ;?></td>
								<td align="center"><?php echo $v['phone'] ;?></td>
								<td align="left"><?php echo $v['email'] ;?></td>
								<td align="center"><?php echo $v['sex']?'女':'男' ;?></td>
								<td align="center"><?php echo $v['state']==1?'<span style="color:#0b9900">启用</span>':'<span style="color:#ff0000">禁用</span>' ;?></td>																
								<td align="center" class="set_text">
								    <?php 
								      if($v['group']!=6){
								    ?>
									<a onClick="return confirm('确定要执行<?php echo $v['state']!=1?'启用':'禁用' ;?>操作吗？');" href="/handle.php?h=admin/update_state&id=<?php echo $v['id'] ;?>&state=<?php echo $v['state']==1?0:1;?>"><?php echo $v['state']!=1?'启用':'禁用' ;?><em>|</em></a>									
									<?php 
									}
									?>
									<a href="/admin/admin_child_edit?id=<?php echo $v['id'] ;?>">修改</a>								
								</td>
					</tr>
							<?php
						}
					}else{
						?>
						<tr>
							<td colspan="10">暂无数据！</td>
						</tr>
						<?php
					}
				?>
				<tr>
					<td colspan="10">
						<div class="list_more">
							用户总数：<?php echo $result['row_count']?$result['row_count']:0 ;?>
							<?php
								echo page_method($result['row_count'], $page, $result['page_count'], 10, '?'.preg_replace('/(&page=\d*)/','',$_SERVER['QUERY_STRING']), false);
							?>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
</body>
</html>

